import { createRouter, createWebHashHistory } from 'vue-router'
// import LoginLoading from '../views/loginLoading.vue'
import Login from '../views/login.vue'
import Layout from '../layout/index.vue'
import ConfigRoutes from './config'

const routes = [
    // {
    //     path: '/login-loading',
    //     component: LoginLoading,
    //     name: 'loginloading'
    // },
    {
        path: '/login',
        name: 'login',
        component: Login
    },
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/reset-pwd',
        name: 'resetPwd',
        component: () => import('../views/resetPwd.vue')
    },
    {
        path: '/layout',
        name: 'layout',
        component: Layout,
    }

]


const router = createRouter({
    routes,
    history: createWebHashHistory()
})

ConfigRoutes.forEach(item => {
    router.addRoute("layout", item)
})
// router.beforeEach((to, from, next) => {
//     console.log(to.fullPath);
// })
export default router 